package com.hex.ds.hdtp.core.app.data.transfer.converter;

import cn.hutool.core.date.DateUtil;
import com.hex.ds.hdtp.core.app.data.transfer.dto.response.DataTransferDownwardNumResponseDto;
import com.hex.ds.hdtp.core.app.data.transfer.dto.request.DataTransferTaskRequestDto;
import com.hex.ds.hdtp.core.app.data.transfer.dto.response.DataTransferListResponseDto;
import com.hex.ds.hdtp.core.app.data.transfer.dto.response.DataTransferTaskResponseDto;
import com.hex.ds.hdtp.core.app.data.transfer.entry.SourceInfo;
import com.hex.ds.hdtp.core.inf.data.transfer.po.DataTransferTaskPo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

/**
 * @Package: com.hex.ds.hdtp.core.app.data.transfer.converter
 * @ClassName IDataTransferTaskConverter
 * @Description: 数据迁移任务-DTO和PO对象转换
 * @Author: wz.li
 * @Date 2023/8/17 19:55
 * @Version v2.0.2
 **/
@Mapper(componentModel = "spring", imports = {DateUtil.class})
public interface IDataTransferTaskConverter {

    @Mapping(target = "startTime",  expression = "java(DateUtil.now())")
    DataTransferTaskPo toPo(DataTransferTaskRequestDto dataTransferTaskRequestDto);

    List<DataTransferTaskResponseDto> toDtoList(List<DataTransferTaskPo> dataTransferTaskPos);


    @Mapping(target = "taskId" ,source = "taskId")
    @Mapping(target = "downNumInfo" ,source = "dataTransferListResponseDtoList")
    DataTransferDownwardNumResponseDto toDataTransferDownwardNumRequestDto(String taskId, String sourceConnId, List<DataTransferListResponseDto> dataTransferListResponseDtoList, SourceInfo sourceInfo);


}
